home *** CD-ROM | disk | FTP | other *** search
- /*
- File: VirtualFolder.h
-
- Copyright: © 1991-1994 by Apple Computer, Inc.
- All rights reserved.
-
- Part of the AOCE Sample SMSAM Package. Consult the license
- which came with this software for your specific legal rights.
-
- */
-
-
-
- #ifndef __VIRTUALFOLDER__
- #define __VIRTUALFOLDER__
-
- #ifndef __HANDLEOBJECT__
- #include "HandleObject.h"
- #endif
-
- #ifndef __OBJECTLIST__
- #include "ObjectList.h"
- #endif
-
- #ifndef __VIRTUALMACFILE__
- #include "VirtualMacFile.h"
- #endif
-
- #ifndef __FILES__
- #include <Files.h>
- #endif
-
- #pragma push
- #pragma segment VirtualFolder
-
- class TMacFileList;
- class TFolderList;
-
- /***********************************|****************************************/
-
- class TVirtualFolder : public THandleObject
- {
- public: TVirtualFolder ( const Str255 fileName );
- TVirtualFolder ( const char* fileName );
- TVirtualFolder ( const FSSpec&, Boolean mimicActualHFS = false );
-
- virtual ~TVirtualFolder();
-
- unsigned long FileCount() const;
- unsigned long FolderCount() const;
- unsigned long TotalSize() const;
-
- OSErr AddFile(TVirtualMacFile* );
- void RemoveFile(TVirtualMacFile* );
-
- OSErr AddFolder(TVirtualFolder* );
- void RemoveFolder(TVirtualFolder* );
-
- TVirtualMacFile* GetIndexFile(unsigned long index) const;
- TVirtualFolder* GetIndexFolder(unsigned long index) const;
-
- void SetFolderName(const Str255 folderName );
- void SetFolderName(const char* folderName );
- void GetFolderName(Str255 folderName ) const;
-
- OSErr SetFinderInfo (const FInfo& );
- OSErr GetFinderInfo (FInfo& ) const;
-
- OSErr GetDate (unsigned long& dateTime,TVirtualMacFile::WhichDateType whichDate) const;
- OSErr SetDate (unsigned long dateTime,TVirtualMacFile::WhichDateType whichDate);
-
- OSErr WriteToDisk ( short vRefNum, long parID );
- OSErr WriteContentsToDisk ( short vRefNum, long parID );
-
- protected: void InheritDown ( const FSSpec& fileSpec );
- Boolean IsFileFolderNameUnique(const StringPtr ) const;
-
- FSSpec fSpec;
- TMacFileList* fFileList;
- TFolderList* fFolderList;
- };
-
- /***********************************|****************************************/
-
- DeclareList ( TVirtualMacFile, TMacFileList );
- DeclareList ( TVirtualFolder, TFolderList );
-
- inline unsigned long TVirtualFolder::FileCount() const { return fFileList->Count(); }
- inline unsigned long TVirtualFolder::FolderCount() const { return fFolderList->Count(); }
- inline void TVirtualFolder::RemoveFile(TVirtualMacFile* aFile) { fFileList->Remove(aFile); }
- inline void TVirtualFolder::RemoveFolder(TVirtualFolder* aFolder) { fFolderList->Remove(aFolder); }
- inline TVirtualFolder* TVirtualFolder::GetIndexFolder(unsigned long index) const{return fFolderList->Get(index);}
- inline TVirtualMacFile* TVirtualFolder::GetIndexFile(unsigned long index) const{return fFileList->Get(index);}
-
- /***********************************|****************************************/
-
- #pragma pop
-
- #endif // __VIRTUALFOLDER__
-
-